<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('queryList',"ArticleController@queryList");
Route::get('list',"ArticleController@list");
Route::get('detail',"ArticleController@detail");

//add get 请求展示页面
Route::get('add',function (){
    return view('article-add');
});

// add post请求
Route::post('add',"ArticleController@add");

// 编辑数据 支持post也支持get post是修改 get是展示视图
Route::any('editor',"ArticleController@editor");

Route::any('detail',"ArticleController@detail");

// 删除数据
Route::get('delete',"ArticleController@delete");
// 批量删除
Route::get('batchDelete',"ArticleController@batchDelete");
// 修改状态
Route::post('updateStatus',"ArticleController@updateStatus");


Route::get('login',function (){
    return view('login');
});

Route::get('useRedis',"ArticleController@useRedis");

/**
 * 分类有关路由
 */
Route::get('addCategory',"CategoryController@addCategory");


/**
 * 文章有关API
 */
Route::prefix('api')->group(function (){
    Route::get('list',"ApiController@list");
    Route::get('delete',"ApiController@delete");
    Route::get('test',"ApiController@test");
});


/**
 * 博客后台有关
 */

Route::prefix('blog')->group(function (){
    /**
     * 登录页面
     */
    Route::get('/login',"LoginController@login");
    Route::post('/doLogin',"LoginController@doLogin");//登录
    /**
     * 发送验证码
     */
    Route::post('sendCode',"LoginController@sendCode");
    /**
     * 首页
     */
    Route::get('/index',"IndexController@index")->middleware('login');

    Route::get('/admin-list',"AdminController@list");
    Route::get('/role-list',"RoleController@list");
    Route::get('/auth-list',"AuthController@list");

    /**
     * 文章有关的
     */
    Route::get('article-list',"ArticleController@articleList");
});



